<?php


namespace app\admin\controller;


use app\admin\model\House as HouseModel;
use app\common\controller\AdminController;
use think\Exception;

class Index extends AdminController {

    public $levelConfig = [
        1 => ['home'],
        2 => [],
        4 => [],
        8 => []
    ];

    /**
     * 首页统计
     * @return false|string
     */
    public function home() {
        try {
            $params = $this->checkParams('start_time1,end_time1,start_time2,end_time2');
            if ($params === false) return $this->resErr();
            list($total, $catch, $bulu, $offShelf, $daibulu, $daijiucuo, $daibulou, $buluLine, $jdLine, $aliLine, $catchLine_date) = HouseModel::statistics($params);
            return $this->resData('success', compact('total', 'catch', 'bulu', 'offShelf', 'daibulu', 'daijiucuo', 'daibulou', 'buluLine', 'jdLine', 'aliLine', 'catchLine_date'));
        } catch (Exception $e) {
            return $this->resErr($e->getMessage(), $e->getCode());
        }
    }

}